package kata11;

public class Sorting2 {
    private String word;

    public void setWord(String word) {
        this.word = word;
    }

    public String sort(){
        if(word == null || word.trim().length() == 0){
            return "";
        }
        //单词转小写
        word = word.trim().toLowerCase();

        char[] chars = word.toCharArray();
        int charsSize = chars.length;

        StringBuilder result = new StringBuilder();

        //a = 97
        for (int i = 97;i <= 122; i++){
            for (int j = 0;j < charsSize;j++) {
                if(i == chars[j]){
                    result.append(chars[j]);
                }
            }
        }

        return result.toString();
    }
}
